package cn.juque.jdfsystem.console.controller.api;

import cn.juque.jdfsystem.console.controller.BaseController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author juque
 * @version 1.0.0
 * <ul>
 *     <li>FileInfoApiController</li>
 * </ul>
 * @date 2023-01-20 09:14:43
 **/
@Slf4j
@Controller
@RequestMapping("/jdf/api/file")
public class FileInfoApiController extends BaseController {

    /**
     * 上传
     *
     * @param servletResponse HttpServletResponse
     * @throws IOException IOException
     */
    @PostMapping(value = "/upload")
    @ResponseBody
    public void upload(HttpServletResponse servletResponse) throws IOException {
        servletResponse.sendRedirect("/jdf/api/file/upload");
    }

    /**
     * 同步变更状态
     *
     * @param servletResponse HttpServletResponse
     */
    @PostMapping(value = "/trustFile")
    @ResponseBody
    public void trustFile(HttpServletResponse servletResponse) throws IOException {
        servletResponse.sendRedirect("/jdf/api/file/trustFile");
    }
}
